{% extends 'base_page.html' %}
{% import 'bootstrap/wtf.html' as wtf %}

{% block navbar_brand %} 设备 {% endblock navbar_brand %}
{% block main_index_attribs %}class="nav-item active"{% endblock main_index_attribs %}

{% block page_content %}
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-12">
                <div class="card strpied-tabled-with-hover">
                    <div class="card-body table-full-width table-responsive">
                        <table class="table table-hover table-striped">
                            <thead>
                                <th>设备号</th>
                                <th>名称</th>
                                <th>设备IP</th>
                                <th>状态</th>
                                <th>操作</th>
                            </thead>
                            <tbody>
                                {% for device in devices %}
                                    <tr>
                                        <td>{{device.id}}</td>
                                        <td>{{device.name}}</td>
                                        <td>{{device.IP}}</td>
                                        <td>{{device.desc}}</td>
                                        <td>
                                            {% if device.status == 0 %}
                                                <button type="button" class="btn btn-xs btn-primary disabled">重启</button>
                                                <button type="button" style="margin-left:5px" class="btn btn-xs btn-danger disabled">关机</button>
                                            {% else %}
                                                <button type="button" class="btn btn-xs btn-primary ">重启</button>
                                                <button type="button" style="margin-left:5px" class="btn btn-xs btn-danger ">关机</button>
                                            {% endif %}
                                        </td>
                                    </tr>
                                {% endfor %}
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
{% endblock %}